Telegram Group & Telegram Channel
141. WAP to multiply and add two complex numbers

Input :
5
-4
4
6

Output :
Sum is 9 + 2i
Product is 44 + 14i

#include<stdio.h>
#include<conio.h>

typedef struct {
int real;
int imag;
} complex;

void getdata (complex *);
void display (complex);
complex sum(complex,complex);
complex mult(complex,complex);

main() {
complex c1,c2,c3,c4;
getdata(&c1);
getdata(&c2);

c3=sum(c1,c2);
printf("Sum is ");
display(c3);

c4=mult(c1,c2);
printf("Product is ");
display(c4);

getch();
}

void getdata(complex *p) {
printf("Enter real ");
scanf("%d",&p->real);
printf("Enter imag ");
scanf("%d",&p->imag);
}

complex sum(complex c1,complex c2) {
complex t;
t.real=c1.real+c2.real;
t.imag=c1.imag+c2.imag;
return t;
}

complex mult(complex c1,complex c2) {
complex t;
t.real=c1.real*c2.real-c1.imag*c2.imag;
t.imag=c1.real*c2.imag+c2.real*c1.imag;
return t;
}

void display {
if(c.imag>=0)
printf("%d+%di\n",c.real,c.imag);
else
printf("%d%di\n",c.real,c.imag);
}
#program_by : @PLAUnit61398



tg-me.com/C_Codings/203
Create:
Last Update:

141. WAP to multiply and add two complex numbers

Input :
5
-4
4
6

Output :
Sum is 9 + 2i
Product is 44 + 14i

#include<stdio.h>
#include<conio.h>

typedef struct {
int real;
int imag;
} complex;

void getdata (complex *);
void display (complex);
complex sum(complex,complex);
complex mult(complex,complex);

main() {
complex c1,c2,c3,c4;
getdata(&c1);
getdata(&c2);

c3=sum(c1,c2);
printf("Sum is ");
display(c3);

c4=mult(c1,c2);
printf("Product is ");
display(c4);

getch();
}

void getdata(complex *p) {
printf("Enter real ");
scanf("%d",&p->real);
printf("Enter imag ");
scanf("%d",&p->imag);
}

complex sum(complex c1,complex c2) {
complex t;
t.real=c1.real+c2.real;
t.imag=c1.imag+c2.imag;
return t;
}

complex mult(complex c1,complex c2) {
complex t;
t.real=c1.real*c2.real-c1.imag*c2.imag;
t.imag=c1.real*c2.imag+c2.real*c1.imag;
return t;
}

void display {
if(c.imag>=0)
printf("%d+%di\n",c.real,c.imag);
else
printf("%d%di\n",c.real,c.imag);
}
#program_by : @PLAUnit61398

BY C Language πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/C_Codings/203

View MORE
Open in Telegram


C Language ‍ Telegram | DID YOU KNOW?

Date: |

However, analysts are positive on the stock now. β€œWe have seen a huge downside movement in the stock due to the central electricity regulatory commission’s (CERC) order that seems to be negative from 2014-15 onwards but we cannot take a linear negative view on the stock and further downside movement on the stock is unlikely. Currently stock is underpriced. Investors can bet on it for a longer horizon," said Vivek Gupta, director research at CapitalVia Global Research.

Telegram Be The Next Best SPAC

I have no inside knowledge of a potential stock listing of the popular anti-Whatsapp messaging app, Telegram. But I know this much, judging by most people I talk to, especially crypto investors, if Telegram ever went public, people would gobble it up. I know I would. I’m waiting for it. So is Sergei Sergienko, who claims he owns $800,000 of Telegram’s pre-initial coin offering (ICO) tokens. β€œIf Telegram does a SPAC IPO, there would be demand for this issue. It would probably outstrip the interest we saw during the ICO. Why? Because as of right now Telegram looks like a liberal application that can accept anyone - right after WhatsApp and others have turn on the censorship,” he says.

C Language ‍ from kr


Telegram C Language πŸ‘¨β€πŸ’»
FROM USA